import request from '../request/index'

export const login = async (data: { account: string; password: string }) => {
    try {
        const res = await request.post<{
            token: string
            user: Object
        }>('/auth/login', data)
        return res.data
    } catch (err) {
        throw err
    }
}

export const register = async (data: any) => {
    try {
        data.location = JSON.stringify(data.location)
        const res = await request.post('/user/register', data)
    } catch (err) {
        throw err
    }
}
